<?php


require('akismet.curl.class.php');


$bad_comment = array(
    'comment_type'              => 'comment',
    'comment_author'            => 'viagra-test-123',
    'comment_author_email'      => 'test@example.com',
    'comment_author_url'        => 'http://www.example.com/',
    'comment_content'           => 'This is a test comment',
    'permalink'                 => 'http://yoursite.com/post.php?id=9999',
);

$good_comment = array(
    'comment_type'              => 'comment',
    'comment_author'            => 'Real Person',
    'comment_author_email'      => 'realemail@site.com',
    'comment_author_url'        => 'http://www.site.com/',
    'comment_content'           => 'Now that Akismet is working I don\'t need to worry about spam messages anymore',
    'permalink'                 => 'http://yoursite.com/post.php?id=9999',
);


//Note: seting the domain name is OPTIONAL!
//$akismet = new akismet('akismet_api_key', 'http://website.com');
$akismet = new akismet('akismet_api_key');

//If there was no problem connecting to Akismet.
if(!$akismet->error) {
    
    //Check to see if the key is valid
    if($akismet->valid_key()) {
        print 'Akismet Key is valid!';
    }
    
    
    if($akismet->is_spam($bad_comment)) {
        print 'Comment Spam!';
    } else {
        print 'Not spam!';
    }
    
    
    if($akismet->is_spam($good_comment)) {
        print 'Spam detected';
    } else {
        print 'yay, no spam!';
    }
    
    
    //If you wish to mark spam missed by akismet
    //$akismet->submit_spam($bad_comment);
    
    
    //If you wish to mark good comments as NOT spam
    //$akismet->submit_ham($good_comment);
}



